<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
         body,
        ul,
        li {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            height: 100%;
        }

        body {
            font: 12px/1.5 Tahoma;
        }

        li {
            list-style-type: none;
        }

        /* visited 选择已访问的链接，并设置其样式： */
        a:link,
        a:visited {
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        #box {
            width: 500px;
            margin: 0 auto;
            overflow: hidden;
        }

        #skin,
        #nav {
            overflow: hidden;
        }

        #skin {
            margin: 10px 0;
        }

        #skin li {
            float: left;
            width: 6px;
            height: 6px;
            cursor: pointer;
            overflow: hidden;
            margin-right: 10px;
            text-indent: -9999px;
            border-width: 4px;
            border-style: solid;
        }

        #skin li.now {
            background: #fff !important;
        }

        #red {
            border-color: red;
            background: red;
        }

        #green {
            border-color: green;
            background: green;
        }

        #black {
            border-color: black;
            background: black;
        }

        #nav {
            border: 1px solid #fff;
        }

        #nav li {
            float: left;
            width: 82px;
            line-height: 25px;
            text-align: center;
            border-right: 1px solid #fff;
        }

        #nav li.last {
            width: 83px;
            border-right-width: 0;
        }

        #nav li a {
            color: #fff;
        } */
    </style>
    <link rel="stylesheet" href="./green.css">
    <script>
        window.onload = function () {
            var link = document.getElementsByTagName("link")[0];
            var skin = document.getElementById("skin").getElementsByTagName("li");
            for (var i = 0; i < skin.length; i++) {
                skin[i].onclick = function () {
                    for (var s in skin) skin[s].className = '';
                    this.className = 'now';
                    link['href'] = this.id + '.css';
                }
            }
        }
    </script>
</head>

<body>
    <div id="box">
        <ul id="skin">
            <li id="red" title="红色">红</li>
            <li id="green" class="now" title="绿色">绿</li>
            <li id="black" title="黑色">黑</li>
        </ul>
        <ul id="nav">
            <li><a href="javascript:;">新闻</a></li>
            <li><a href="javascript:;">娱乐</a></li>
            <li><a href="javascript:;">体育</a></li>
            <li><a href="javascript:;">电影</a></li>
            <li><a href="javascript:;">音乐</a></li>
            <li class="last"><a href="javascript:;">旅游</a></li>
        </ul>
    </div>

</body>

</html>